from typing import Optional

from sqlalchemy import BigInteger, Boolean, Integer, PrimaryKeyConstraint, String, Text
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column

class Base(DeclarativeBase):
    pass


class Users(Base):
    __tablename__ = 'users'
    __table_args__ = (
        PrimaryKeyConstraint('id', name='users_pkey'),
    )

    id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
    username: Mapped[str] = mapped_column(String(100), comment='用户名')
    phone_num: Mapped[str] = mapped_column(String(20), comment='手机号')
    password: Mapped[str] = mapped_column(String(255), comment='密码')
    is_admin: Mapped[Optional[bool]] = mapped_column(Boolean, comment='是否为管理员')
    emp_number: Mapped[Optional[str]] = mapped_column(Text, comment='工号')
    position: Mapped[Optional[int]] = mapped_column(BigInteger, comment='职位')
    department: Mapped[Optional[int]] = mapped_column(Integer, comment='部门')
